package com.huazh.controller;

import com.alibaba.nacos.api.config.annotation.NacosValue;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description:
 * @Authoe: hzh
 * @Time: 2020/7/3117:11
 */
@RestController
@RequestMapping("config")
@RefreshScope
public class NacosConfigController {

    @Value("${server.port}")
    private String port;
    @Value("${myuser.name}")
    String userName;

    @GetMapping("read")
    public String read1(){
        return port;
    }

    @GetMapping("get")
    public String read2(){
        return userName;
    }
}
